<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE Safe #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE DeriveGeneric #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE NoImplicitPrelude #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-6"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Module      :  Data.Version</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Copyright   :  (c) The University of Glasgow 2004</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- License     :  BSD-style (see the file libraries/base/LICENSE)</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Maintainer  :  libraries@haskell.org</span><span>
</span><span id="line-12"></span><span class="hs-comment">-- Stability   :  experimental</span><span>
</span><span id="line-13"></span><span class="hs-comment">-- Portability :  non-portable (local universal quantification in ReadP)</span><span>
</span><span id="line-14"></span><span class="hs-comment">--</span><span>
</span><span id="line-15"></span><span class="hs-comment">-- A general library for representation and manipulation of versions.</span><span>
</span><span id="line-16"></span><span class="hs-comment">--</span><span>
</span><span id="line-17"></span><span class="hs-comment">-- Versioning schemes are many and varied, so the version</span><span>
</span><span id="line-18"></span><span class="hs-comment">-- representation provided by this library is intended to be a</span><span>
</span><span id="line-19"></span><span class="hs-comment">-- compromise between complete generality, where almost no common</span><span>
</span><span id="line-20"></span><span class="hs-comment">-- functionality could reasonably be provided, and fixing a particular</span><span>
</span><span id="line-21"></span><span class="hs-comment">-- versioning scheme, which would probably be too restrictive.</span><span>
</span><span id="line-22"></span><span class="hs-comment">--</span><span>
</span><span id="line-23"></span><span class="hs-comment">-- So the approach taken here is to provide a representation which</span><span>
</span><span id="line-24"></span><span class="hs-comment">-- subsumes many of the versioning schemes commonly in use, and we</span><span>
</span><span id="line-25"></span><span class="hs-comment">-- provide implementations of 'Eq', 'Ord' and conversion to\/from 'String'</span><span>
</span><span id="line-26"></span><span class="hs-comment">-- which will be appropriate for some applications, but not all.</span><span>
</span><span id="line-27"></span><span class="hs-comment">--</span><span>
</span><span id="line-28"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-29"></span><span>
</span><span id="line-30"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.Version</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><span class="hs-comment">-- * The @Version@ type</span></span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier">Version</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><span class="hs-comment">-- * A concrete representation of @Version@</span></span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="Data.Version.html#showVersion"><span class="hs-identifier">showVersion</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Version.html#parseVersion"><span class="hs-identifier">parseVersion</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Constructor function</span></span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="Data.Version.html#makeVersion"><span class="hs-identifier">makeVersion</span></a></span><span>
</span><span id="line-37"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-38"></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Functor.html"><span class="hs-identifier">Data.Functor</span></a></span><span>     </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Base.html#Functor"><span class="hs-identifier">Functor</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Control.Applicative.html"><span class="hs-identifier">Control.Applicative</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Base.html#Applicative"><span class="hs-identifier">Applicative</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Bool.html"><span class="hs-identifier">Data.Bool</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator">(&amp;&amp;)</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Char.html"><span class="hs-identifier">Data.Char</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Unicode.html#isDigit"><span class="hs-identifier">isDigit</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unicode.html#isAlphaNum"><span class="hs-identifier">isAlphaNum</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Eq.html"><span class="hs-identifier">Data.Eq</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Int.html"><span class="hs-identifier">Data.Int</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier">Int</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.List.html"><span class="hs-identifier">Data.List</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Base.html#map"><span class="hs-identifier">map</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.OldList.html#sort"><span class="hs-identifier">sort</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Foldable.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.Foldable.html#concatMap"><span class="hs-identifier">concatMap</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.OldList.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Base.html#%2B%2B"><span class="hs-operator">(++)</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.Ord.html"><span class="hs-identifier">Data.Ord</span></a></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Data.String.html"><span class="hs-identifier">Data.String</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier">String</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Generics.html"><span class="hs-identifier">GHC.Generics</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Read.html"><span class="hs-identifier">GHC.Read</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Show.html"><span class="hs-identifier">GHC.Show</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Text.ParserCombinators.ReadP.html"><span class="hs-identifier">Text.ParserCombinators.ReadP</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="Text.Read.html"><span class="hs-identifier">Text.Read</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="Text.Read.html#read"><span class="hs-identifier">read</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-53"></span><span>
</span><span id="line-54"></span><span class="hs-comment">{- |
A 'Version' represents the version of a software entity.

An instance of 'Eq' is provided, which implements exact equality
modulo reordering of the tags in the 'versionTags' field.

An instance of 'Ord' is also provided, which gives lexicographic
ordering on the 'versionBranch' fields (i.e. 2.1 &gt; 2.0, 1.2.3 &gt; 1.2.2,
etc.).  This is expected to be sufficient for many uses, but note that
you may need to use a more specific ordering for your versioning
scheme.  For example, some versioning schemes may include pre-releases
which have tags @\&quot;pre1\&quot;@, @\&quot;pre2\&quot;@, and so on, and these would need to
be taken into account when determining ordering.  In some cases, date
ordering may be more appropriate, so the application would have to
look for @date@ tags in the 'versionTags' field and compare those.
The bottom line is, don't always assume that 'compare' and other 'Ord'
operations are the right thing for every 'Version'.

Similarly, concrete representations of versions may differ.  One
possible concrete representation is provided (see 'showVersion' and
'parseVersion'), but depending on the application a different concrete
representation may be more appropriate.
-}</span><span>
</span><span id="line-77"></span><span id="local-6989586621679494013"><span id="local-6989586621679494014"></span></span><span class="hs-keyword">data</span><span> </span><span id="Version"><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-var">Version</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-78"></span><span>  </span><span id="Version"><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-var">Version</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="versionBranch"><span class="annot"><span class="annottext">Version -&gt; [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var hs-var">versionBranch</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-79"></span><span>                </span><span class="hs-comment">-- ^ The numeric branch for this version.  This reflects the</span><span>
</span><span id="line-80"></span><span>                </span><span class="hs-comment">-- fact that most software versions are tree-structured; there</span><span>
</span><span id="line-81"></span><span>                </span><span class="hs-comment">-- is a main trunk which is tagged with versions at various</span><span>
</span><span id="line-82"></span><span>                </span><span class="hs-comment">-- points (1,2,3...), and the first branch off the trunk after</span><span>
</span><span id="line-83"></span><span>                </span><span class="hs-comment">-- version 3 is 3.1, the second branch off the trunk after</span><span>
</span><span id="line-84"></span><span>                </span><span class="hs-comment">-- version 3 is 3.2, and so on.  The tree can be branched</span><span>
</span><span id="line-85"></span><span>                </span><span class="hs-comment">-- arbitrarily, just by adding more digits.</span><span>
</span><span id="line-86"></span><span>                </span><span class="hs-comment">--</span><span>
</span><span id="line-87"></span><span>                </span><span class="hs-comment">-- We represent the branch as a list of 'Int', so</span><span>
</span><span id="line-88"></span><span>                </span><span class="hs-comment">-- version 3.2.1 becomes [3,2,1].  Lexicographic ordering</span><span>
</span><span id="line-89"></span><span>                </span><span class="hs-comment">-- (i.e. the default instance of 'Ord' for @[Int]@) gives</span><span>
</span><span id="line-90"></span><span>                </span><span class="hs-comment">-- the natural ordering of branches.</span><span>
</span><span id="line-91"></span><span>
</span><span id="line-92"></span><span>           </span><span id="versionTags"><span class="annot"><span class="annottext">Version -&gt; [String]
</span><a href="Data.Version.html#versionTags"><span class="hs-identifier hs-var hs-var">versionTags</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- really a bag</span><span>
</span><span id="line-93"></span><span>                </span><span class="hs-comment">-- ^ A version can be tagged with an arbitrary list of strings.</span><span>
</span><span id="line-94"></span><span>                </span><span class="hs-comment">-- The interpretation of the list of tags is entirely dependent</span><span>
</span><span id="line-95"></span><span>                </span><span class="hs-comment">-- on the entity that this version applies to.</span><span>
</span><span id="line-96"></span><span>        </span><span class="hs-special">}</span><span>
</span><span id="line-97"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621679493989"><span id="local-6989586621679494003"><span id="local-6989586621679494006"><span id="local-6989586621679494008"><span class="annot"><span class="annottext">ReadPrec [Version]
ReadPrec Version
Int -&gt; ReadS Version
ReadS [Version]
(Int -&gt; ReadS Version)
-&gt; ReadS [Version]
-&gt; ReadPrec Version
-&gt; ReadPrec [Version]
-&gt; Read Version
forall a.
(Int -&gt; ReadS a)
-&gt; ReadS [a] -&gt; ReadPrec a -&gt; ReadPrec [a] -&gt; Read a
readListPrec :: ReadPrec [Version]
$creadListPrec :: ReadPrec [Version]
readPrec :: ReadPrec Version
$creadPrec :: ReadPrec Version
readList :: ReadS [Version]
$creadList :: ReadS [Version]
readsPrec :: Int -&gt; ReadS Version
$creadsPrec :: Int -&gt; ReadS Version
</span><a href="GHC.Read.html#Read"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Read</span></a></span></span></span></span></span><span>    </span><span class="hs-comment">-- ^ @since 2.01</span><span>
</span><span id="line-98"></span><span>           </span><span class="hs-special">,</span><span> </span><span id="local-6989586621679493973"><span id="local-6989586621679493975"><span id="local-6989586621679493983"><span class="annot"><span class="annottext">Int -&gt; Version -&gt; ShowS
[Version] -&gt; ShowS
Version -&gt; String
(Int -&gt; Version -&gt; ShowS)
-&gt; (Version -&gt; String) -&gt; ([Version] -&gt; ShowS) -&gt; Show Version
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Version] -&gt; ShowS
$cshowList :: [Version] -&gt; ShowS
show :: Version -&gt; String
$cshow :: Version -&gt; String
showsPrec :: Int -&gt; Version -&gt; ShowS
$cshowsPrec :: Int -&gt; Version -&gt; ShowS
</span><a href="GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span>    </span><span class="hs-comment">-- ^ @since 2.01</span><span>
</span><span id="line-99"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(forall x. Version -&gt; Rep Version x)
-&gt; (forall x. Rep Version x -&gt; Version) -&gt; Generic Version
forall x. Rep Version x -&gt; Version
forall x. Version -&gt; Rep Version x
forall a.
(forall x. a -&gt; Rep a x) -&gt; (forall x. Rep a x -&gt; a) -&gt; Generic a
$cto :: forall x. Rep Version x -&gt; Version
$cfrom :: forall x. Version -&gt; Rep Version x
</span><a href="GHC.Generics.html#Generic"><span class="hs-identifier hs-var hs-var hs-var hs-var">Generic</span></a></span><span> </span><span class="hs-comment">-- ^ @since 4.9.0.0</span><span>
</span><span id="line-100"></span><span>           </span><span class="hs-special">)</span><span>
</span><span id="line-101"></span><span class="hs-pragma">{-# DEPRECATED</span><span> </span><span class="hs-pragma">versionTags</span><span> </span><span class="hs-pragma">&quot;See GHC ticket #2496&quot;</span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-102"></span><span class="hs-comment">-- TODO. Remove all references to versionTags in GHC 8.0 release.</span><span>
</span><span id="line-103"></span><span>
</span><span id="line-104"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-105"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679493963"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Eq"><span class="hs-identifier hs-type">Eq</span></a></span><span> </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-106"></span><span>  </span><span id="local-6989586621679493948"><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493948"><span class="hs-identifier hs-var">v1</span></a></span></span><span> </span><span id="local-6989586621679493947"><span class="annot"><span class="annottext">== :: Version -&gt; Version -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var hs-var hs-var hs-var">==</span></a></span></span><span> </span><span id="local-6989586621679493946"><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493946"><span class="hs-identifier hs-var">v2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span>  </span><span class="annot"><span class="annottext">Version -&gt; [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var hs-var">versionBranch</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493948"><span class="hs-identifier hs-var">v1</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; [Int] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">Version -&gt; [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var hs-var">versionBranch</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493946"><span class="hs-identifier hs-var">v2</span></a></span><span>
</span><span id="line-107"></span><span>                </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%26%26"><span class="hs-operator hs-var">&amp;&amp;</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Ord a =&gt; [a] -&gt; [a]
</span><a href="Data.OldList.html#sort"><span class="hs-identifier hs-var">sort</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Version -&gt; [String]
</span><a href="Data.Version.html#versionTags"><span class="hs-identifier hs-var hs-var">versionTags</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493948"><span class="hs-identifier hs-var">v1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><a href="../../ghc-prim/src/GHC.Classes.html#%3D%3D"><span class="hs-operator hs-var">==</span></a></span><span> </span><span class="annot"><span class="annottext">[String] -&gt; [String]
forall a. Ord a =&gt; [a] -&gt; [a]
</span><a href="Data.OldList.html#sort"><span class="hs-identifier hs-var">sort</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Version -&gt; [String]
</span><a href="Data.Version.html#versionTags"><span class="hs-identifier hs-var hs-var">versionTags</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493946"><span class="hs-identifier hs-var">v2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-108"></span><span>                </span><span class="hs-comment">-- tags may be in any order</span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="hs-comment">-- | @since 2.01</span><span>
</span><span id="line-111"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621679493931"><span id="local-6989586621679493933"><span id="local-6989586621679493935"><span id="local-6989586621679493937"><span id="local-6989586621679493939"><span id="local-6989586621679493941"><span class="annot"><a href="../../ghc-prim/src/GHC.Classes.html#Ord"><span class="hs-identifier hs-type">Ord</span></a></span><span> </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span></span></span></span></span></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-112"></span><span>  </span><span id="local-6989586621679493927"><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493927"><span class="hs-identifier hs-var">v1</span></a></span></span><span> </span><span id="local-6989586621679493926"><span class="annot"><span class="annottext">compare :: Version -&gt; Version -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-operator hs-var hs-var hs-var hs-var">`compare`</span></a></span></span><span> </span><span id="local-6989586621679493924"><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493924"><span class="hs-identifier hs-var">v2</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Version -&gt; [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var hs-var">versionBranch</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493927"><span class="hs-identifier hs-var">v1</span></a></span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; [Int] -&gt; Ordering
forall a. Ord a =&gt; a -&gt; a -&gt; Ordering
</span><a href="../../ghc-prim/src/GHC.Classes.html#compare"><span class="hs-operator hs-var">`compare`</span></a></span><span> </span><span class="annot"><span class="annottext">Version -&gt; [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var hs-var">versionBranch</span></a></span><span> </span><span class="annot"><span class="annottext">Version
</span><a href="#local-6989586621679493924"><span class="hs-identifier hs-var">v2</span></a></span><span>
</span><span id="line-113"></span><span>
</span><span id="line-114"></span><span class="hs-comment">-- -----------------------------------------------------------------------------</span><span>
</span><span id="line-115"></span><span class="hs-comment">-- A concrete representation of 'Version'</span><span>
</span><span id="line-116"></span><span>
</span><span id="line-117"></span><span class="hs-comment">-- | Provides one possible concrete representation for 'Version'.  For</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- a version with 'versionBranch' @= [1,2,3]@ and 'versionTags'</span><span>
</span><span id="line-119"></span><span class="hs-comment">-- @= [\&quot;tag1\&quot;,\&quot;tag2\&quot;]@, the output will be @1.2.3-tag1-tag2@.</span><span>
</span><span id="line-120"></span><span class="hs-comment">--</span><span>
</span><span id="line-121"></span><span class="annot"><a href="Data.Version.html#showVersion"><span class="hs-identifier hs-type">showVersion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-122"></span><span id="showVersion"><span class="annot"><span class="annottext">showVersion :: Version -&gt; String
</span><a href="Data.Version.html#showVersion"><span class="hs-identifier hs-var hs-var">showVersion</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span><span> </span><span id="local-6989586621679493923"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493923"><span class="hs-identifier hs-var">branch</span></a></span></span><span> </span><span id="local-6989586621679493922"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679493922"><span class="hs-identifier hs-var">tags</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-123"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; String
forall (t :: * -&gt; *) a. Foldable t =&gt; t [a] -&gt; [a]
</span><a href="Data.Foldable.html#concat"><span class="hs-identifier hs-var">concat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
forall a. a -&gt; [a] -&gt; [a]
</span><a href="Data.OldList.html#intersperse"><span class="hs-identifier hs-var">intersperse</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;.&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Int -&gt; String) -&gt; [Int] -&gt; [String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493923"><span class="hs-identifier hs-var">branch</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">String -&gt; ShowS
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-124"></span><span>     </span><span class="annot"><span class="annottext">ShowS -&gt; [String] -&gt; String
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span class="annot"><span class="annottext">Char -&gt; ShowS
forall a. a -&gt; [a] -&gt; [a]
</span><a href="../../ghc-prim/src/GHC.Types.html#%3A"><span class="hs-glyph hs-var">:</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679493922"><span class="hs-identifier hs-var">tags</span></a></span><span>
</span><span id="line-125"></span><span>
</span><span id="line-126"></span><span class="hs-comment">-- | A parser for versions in the format produced by 'showVersion'.</span><span>
</span><span id="line-127"></span><span class="hs-comment">--</span><span>
</span><span id="line-128"></span><span class="annot"><a href="Data.Version.html#parseVersion"><span class="hs-identifier hs-type">parseVersion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Text.ParserCombinators.ReadP.html#ReadP"><span class="hs-identifier hs-type">ReadP</span></a></span><span> </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span><span>
</span><span id="line-129"></span><span id="parseVersion"><span class="annot"><span class="annottext">parseVersion :: ReadP Version
</span><a href="Data.Version.html#parseVersion"><span class="hs-identifier hs-var hs-var">parseVersion</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621679493920"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493920"><span class="hs-identifier hs-var">branch</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadP Int -&gt; ReadP Char -&gt; ReadP [Int]
forall a sep. ReadP a -&gt; ReadP sep -&gt; ReadP [a]
</span><a href="Text.ParserCombinators.ReadP.html#sepBy1"><span class="hs-identifier hs-var">sepBy1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; Int) -&gt; ReadP String -&gt; ReadP Int
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; Int
forall a. Read a =&gt; String -&gt; a
</span><a href="Text.Read.html#read"><span class="hs-identifier hs-var">read</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; ReadP String
</span><a href="Text.ParserCombinators.ReadP.html#munch1"><span class="hs-identifier hs-var">munch1</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="GHC.Unicode.html#isDigit"><span class="hs-identifier hs-var">isDigit</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; ReadP Char
</span><a href="Text.ParserCombinators.ReadP.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span class="hs-special">)</span><span>
</span><span id="line-130"></span><span>                  </span><span id="local-6989586621679493916"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679493916"><span class="hs-identifier hs-var">tags</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">ReadP String -&gt; ReadP [String]
forall a. ReadP a -&gt; ReadP [a]
</span><a href="Text.ParserCombinators.ReadP.html#many"><span class="hs-identifier hs-var">many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; ReadP Char
</span><a href="Text.ParserCombinators.ReadP.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'-'</span></span><span> </span><span class="annot"><span class="annottext">ReadP Char -&gt; ReadP String -&gt; ReadP String
forall (f :: * -&gt; *) a b. Applicative f =&gt; f a -&gt; f b -&gt; f b
</span><a href="GHC.Base.html#%2A%3E"><span class="hs-operator hs-var">*&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">(Char -&gt; Bool) -&gt; ReadP String
</span><a href="Text.ParserCombinators.ReadP.html#munch1"><span class="hs-identifier hs-var">munch1</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; Bool
</span><a href="GHC.Unicode.html#isAlphaNum"><span class="hs-identifier hs-var">isAlphaNum</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-131"></span><span>                  </span><span class="annot"><span class="annottext">Version -&gt; ReadP Version
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="annot"><span class="annottext">Version :: [Int] -&gt; [String] -&gt; Version
</span><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span><span class="hs-special">{</span><span class="annot"><span class="annottext">versionBranch :: [Int]
</span><a href="Data.Version.html#versionBranch"><span class="hs-identifier hs-var">versionBranch</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493920"><span class="hs-identifier hs-var">branch</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">versionTags :: [String]
</span><a href="Data.Version.html#versionTags"><span class="hs-identifier hs-var">versionTags</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679493916"><span class="hs-identifier hs-var">tags</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-132"></span><span>
</span><span id="line-133"></span><span class="hs-comment">-- | Construct tag-less 'Version'</span><span>
</span><span id="line-134"></span><span class="hs-comment">--</span><span>
</span><span id="line-135"></span><span class="hs-comment">-- @since 4.8.0.0</span><span>
</span><span id="line-136"></span><span class="annot"><a href="Data.Version.html#makeVersion"><span class="hs-identifier hs-type">makeVersion</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Int"><span class="hs-identifier hs-type">Int</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.Version.html#Version"><span class="hs-identifier hs-type">Version</span></a></span><span>
</span><span id="line-137"></span><span id="makeVersion"><span class="annot"><span class="annottext">makeVersion :: [Int] -&gt; Version
</span><a href="Data.Version.html#makeVersion"><span class="hs-identifier hs-var hs-var">makeVersion</span></a></span></span><span> </span><span id="local-6989586621679493914"><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493914"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Int] -&gt; [String] -&gt; Version
</span><a href="Data.Version.html#Version"><span class="hs-identifier hs-var">Version</span></a></span><span> </span><span class="annot"><span class="annottext">[Int]
</span><a href="#local-6989586621679493914"><span class="hs-identifier hs-var">b</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-138"></span></pre></body></html>